import 'package:flutter/material.dart';

import '../common/animated_wrapper_common.dart';

class AnimatedWrapperPage1 extends StatefulWidget {
  const AnimatedWrapperPage1({Key key}) : super(key: key);

  @override
  State<AnimatedWrapperPage1> createState() => _AnimatedWrapperPage1State();
}

class _AnimatedWrapperPage1State extends State<AnimatedWrapperPage1> {
  @override
  Widget build(BuildContext context) {
    double scw = MediaQuery.of(context).size.width;
    double itemWidth = scw / 3;
    List<Widget> items = [];
    int count = 10;
    for (int i = 0; i < count; i++) {
      items.add(Item(itemWidth, ItemModel(randomColor()), onMove: (ItemModel model) {}));
    }

    return Scaffold(
      appBar: AppBar(
        title: Text("animated wrapper1"),
      ),
      body: Stack(
        children: [
          Wrap(children: items),
          MovingItem(itemWidth, count),
        ],
      ),
    );
  }
}
